<html>
<head>
<title>异想之旅聊天</title>
</head>
<body>
注册：
<table border="0">
<tr>
  <td><input type="text" id="logname" placeholder="用户名"></td>
  <td><input type="text" id="logpswd" placeholder="用户密码"></td>
</tr>
<tr>
  
  <td><button id="login" type="button">注册</button></td>
</tr>
</table>

<script type="text/javascript" src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.3.1/jquery.min.js"></script>
<script>
$('#login').on('click',function(){
    //document.getElementById("mframe").src = "/have/"+document.getElementById("havename").value+"/"+document.getElementById("havepswd").value+"#bottom";
    data={"logname": document.getElementById("logname").value,
    "logpswd": document.getElementById("logpswd").value}
    
    $.ajax({
    type: 'post',
    url: "/log",
    data: JSON.stringify(data), 
    contentType: 'application/json; charset=UTF-8',
    dataType: 'text', 
    success: function(data) {
        alert(data);
        location.reload();
    },
    error: function(xhr, type) {alert(type);}
    });
    
    //document.getElementById("mframe").reload();
});
</script>
</body>
</html>